﻿<!DOCTYPE html>

<html>
<head>
    <title>@ViewBag.Title</title>
    <link href="~/Content/css/framework-font.css" rel="stylesheet" />
    <link href="~/Content/css/framework-theme.css" rel="stylesheet" />
    <script src="~/Content/js/jquery/jquery-2.1.1.min.js"></script>
    <script src="~/Content/js/jquery-ui/jquery-ui.min.js"></script>
    <script src="~/Content/js/bootstrap/bootstrap.js"></script>
    <link href="~/Content/js/bootstrap/bootstrap.min.css" rel="stylesheet" />
    <script src="~/Content/js/layout/jquery.layout.js"></script>
    <script src="~/Content/js/wdtree/tree.js"></script>
    <link href="~/Content/js/wdtree/tree.css" rel="stylesheet" />
    <script src="~/Content/js/jqgrid/jqgrid.min.js"></script>
    <link href="~/Content/js/jqgrid/jqgrid.css" rel="stylesheet" />
    <script src="~/Content/js/jqgrid/grid.locale-cn.js"></script>
    <link href="~/Content/css/framework-ui.css" rel="stylesheet" />
    <script src="~/Content/js/framework-ui.js"></script>
    <style>
        html, body {
            height: 100%;
            width: 100%;
        }
        .tab-pane {
            margin: 10px;
            margin-bottom: 0px;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            var content_height = $(window).height() - 55;
            $("#myTabContent").height(content_height);
            getTabs();
        });
        function getTabs() {
            $.ajax({
                url: "/SystemManage/Module/GetFunMenuList?time="+new Date().getTime(),
                dataType: "json",
                async: false,
                success: function (data) {
                    var _html = '';
                    $.each(data, function (i) {
                        var row = data[i];
                        _html += '<li><a href="#Manufacture_' + row.F_Id + '" data-toggle="tab" target-url="' + row.F_UrlAddress + '">' + row.F_FullName + '</a></li>'
                    });
                    $("#myTab").html("");
                    $("#myTab").prepend(_html);
                    $("#myTab li:first").addClass("active");
                    //alert($("#myTab li:first").html());
                    //alert(data.length);
                    if (data.length > 0) {
                        row = data[0]
                        $("#myTabContent").html("");
                        var newhtml = '<iframe class="FriendStar_iframe" id="Manufacture_' + row.F_Id + '" name="Manufacture_' + row.F_Id + '" width="100%" height="100%" src="' + row.F_UrlAddress + '" frameborder="0"></iframe>';
                        $("#myTabContent").append(newhtml);
                    }
                }
            });
            $('#myTab a').on("click", function () {
                var id = $(this).attr("href");
                var url = $(this).attr("target-url");
                var name = $(this).text();
                if ($(id).length > 0) {
                    $(id).show().siblings().hide();
                    var newid = id.replace('#', '');
                    //alert(name);
                    //frames[newid].$.reload();
                    if (name == "生产编号对照表") {
                        frames[newid].hideEditDiv();
                    } else if (name == "产品工艺路线") {
                        var iframeId = $(".FriendStar_iframe:visible").attr("id");
                        frames[newid].frames[iframeId].$.detailClose();
                    } else {
                        frames[newid].$.detailClose();
                    }
                } else {
                    var newid = id.replace('#', '');
                    var newhtml = '<iframe class="FriendStar_iframe" id="' + newid + '" name="' + newid + '" width="100%" height="100%" src="' + url + '" frameborder="0"></iframe>';
                    $("#myTabContent").append(newhtml);
                    $(id).show().siblings().hide();
                }
            });
        }
    </script>
</head>
<body>
    @RenderBody()
    <div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
        <ul id="myTab" class="nav nav-tabs">
            <li>&nbsp;</li>
        </ul>
        <div id="myTabContent" class="tab-content">
        </div>
    </div>
    @Html.AntiForgeryToken()
</body>
</html>
